package com.liyuxiang.yygh.order.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtils implements InitializingBean {
    @Value("${zfb.open_api_domain}")
    private String openApiDomain;
    @Value("${zfb.mcloud_api_domain}")
    private String mCloudApiDomain;
    @Value("${zfb.pid}")
    private String pid;
    @Value("${zfb.appid}")
    private String appid;
    @Value("${zfb.notify_url}")
    private String notifyUrl;
    @Value("${zfb.private_key}")
    private String privateKey;
    @Value("${zfb.public_key}")
    private String publicKey;
    @Value("${zfb.alipay_public_key}")
    private String alipayPublicKey;
    @Value("${zfb.sign_type}")
    private String signType;
    @Value("${zfb.max_query_retry}")
    private String maxQueryRetry;
    @Value("${zfb.query_duration}")
    private String queryDuration;
    @Value("${zfb.max_cancel_retry}")
    private String maxCancelRetry;
    @Value("${zfb.cancel_duration}")
    private String cancelDuration;
    @Value("${zfb.heartbeat_duration}")
    private String heartbeatDuration;


    public static String OPEN_API_DOMAIN;
    public static String M_CLOUD_API_DOMAIN;
    public static String PID;
    public static String APP_ID;
    public static String NOTIFY_URL;
    public static String PRIVATE_KEY;
    public static String PUBLIC_KEY;
    public static String ALIPAY_PUBLIC_KEY;
    public static String SIGN_TYPE;
    public static String MAX_QUERY_RETRY;
    public static String QUERY_DURATION;
    public static String MAX_CANCEL_RETRY;
    public static String CANCEL_DURATION;
    public static String HEARTBEAT_DURATION;

    @Override
    public void afterPropertiesSet() throws Exception {
        OPEN_API_DOMAIN = openApiDomain;
        M_CLOUD_API_DOMAIN = mCloudApiDomain;
        PID = pid;
        APP_ID = appid;
        NOTIFY_URL = notifyUrl;
        PRIVATE_KEY = privateKey;
        PUBLIC_KEY = publicKey;
        ALIPAY_PUBLIC_KEY = alipayPublicKey;
        SIGN_TYPE = signType;
        MAX_QUERY_RETRY = maxQueryRetry;
        QUERY_DURATION = queryDuration;
        MAX_CANCEL_RETRY = maxCancelRetry;
        CANCEL_DURATION = cancelDuration;
        HEARTBEAT_DURATION = heartbeatDuration;
    }
}
